<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<meta http-equiv="keywords" content="" />
		<meta http-equiv="description" content="" />
		<title>見積検索</title>

		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<script src="assets/scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>

		<script src="assets/scripts/ui/jquery-ui-1.7.2.custom.js" type="text/javascript"></script>
		<link type="text/css" href="./assets/styles/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		<script type="text/javascript">
		$(function() {
			// メッセージのフェード
			$('.message').fadeIn("slow");
			
			$('#btn_reset').click(function(){	
				location.href = "price_check.php";
			});
		});
		</script>
		
		<!--時間制御開始 -->
		<script>
		$(document).ready(function(){ 
			$("#r_date1").wrDate();  
			$("#r_date2").wrDate();  
			$("#u_date1").wrDate();  
			$("#u_date2").wrDate();  
			$("#u_date3").wrDate();  
			$("#u_date4").wrDate();  
			$("#u_date5").wrDate();  
			$("#u_date6").wrDate();  
			$("#m_date1").wrDate();  
			$("#m_date2").wrDate();  
			$("#e_date1").wrDate();  
			$("#e_date2").wrDate();  
		});
		
		$.extend({ 
			wrDate : function(objs) { 
			objs.each(function(i) { 
				//jQueryオブジェクトをトラバース  
				var inputObj = $(this); 
				inputObj.datepicker({
					changeMonth: true,
					changeYear: true,
					dateFormat: 'yy/mm/dd'
				}); //各jQueryオブジェクトにCalendarコントロール
			}); 
		}});

		$.fn.extend({ 
			wrDate : function() { 
			//wrDate jQueryプラグインの名前を定義します
			$.wrDate(this); //呼び出す前に、カスタムjQuery関数
		}});
		
		</script>			
		
		<link rel="stylesheet" type="text/css" href="./assets/styles/tablesorter.css" />

		<script type="text/javascript" src="./assets/scripts/tablesorter.js"></script>
		<script type="text/javascript">
			var sorter = new TINY.table.sorter("sorter");
				sorter.head = "head";
				sorter.asc = "asc";
				sorter.desc = "desc";
				sorter.even = "evenrow";
				sorter.odd = "oddrow";
				sorter.evensel = "evenselected";
				sorter.oddsel = "oddselected";
				sorter.paginate = true;
				sorter.currentid = "currentpage";
				sorter.limitid = "pagelimit";
			$(function(){
					sorter.init("inquiry_result",0);
			});
		</script>
		<script>  
     		//chooseOne()函式，參數為觸發該函式的元素本身  
		     function chooseOne(cb){  
		         //先取得同name的chekcBox的集合物件  
		         var obj = document.getElementsByName("status");  
		         for (i=0; i<obj.length; i++){  
		             //判斷obj集合中的i元素是否為cb，若否則表示未被點選  
		             if (obj[i]!=cb) obj[i].checked = false;  
		             //若是 但原先未被勾選 則變成勾選；反之則變為未勾選  
		             //else  obj[i].checked = cb.checked;  
		             //若要至少勾選一個的話，則把上面那行else拿掉，換用下面那行  
		             else obj[i].checked = true;  
		         }  
		     }  
     		
		     function openWin(u, w, h) { 
		            var l = (screen.width - w) / 2; 
		            var t = (screen.height - h) / 2; 
		            var s = 'width=' + w + ', height=' + h + ', top=' + t + ', left=' + l; 
		            s += ', toolbar=yes, scrollbars=yes, menubar=yes, location=no, resizable=yes'; 
		            open(u, 'oWin', s); 
		      } 
	  </script> 
		
		
	</head>
	<body id="">
{{ php }} include( MENU_FILE ); {{ /php }}

		<div id="header" class="clearfix"><div class="wrapper">
			<h1><a href="./">コントロールパネル</a></h1>
			<form id="form_logout" action="logout.php" method="post"><p>{{ $login.staff_name }} <input type="submit" id="button_logout" value="ログアウト" /></p></form>
		</div></div>
		<div id="container"><div class="wrapper">

			<h2>見積管理</h2>
			<ul class="submenu clearfix">
				<li><a href="consumer_index.php">顧客検索</a></li>								
				<li><a href="consumer_form.php">顧客登録</a></li>
				<li><a href="price_task.php">見積タスク一覧</a></li>
				<li>見積検索</li>
				<li><a href="shop_index.php">商品マスタ</a></li>
			</ul>
			<h3>見積検索</h3>	
			<p class="message">条件を入力し、検索ボタンをクリックしてください。</p>
			<form action="price_check.php" method="get">
			<h5>顧客情報</h5>
			<table id="inquiry_result" class="formTable">
				<thead>
					<tr>
						<th>会社名</th>
						<td><input type="text" name="company_name" value="{{$forms.company_name}}" id="text_information" class="text" /></td>
					</tr>
					<tr>
						<th>会社（カタカナ）</th>
						<td><input type="text" name="katakana" value="{{$forms.katakana}}" id="text_information" class="text" /></td>
					</tr>
					<tr>
						<th>支店名</th>
						<td><input type="text" name="branch_name" value="{{$forms.branch_name}}" id="text_information" class="text" /></td>
					</tr>
					<tr>
						<th>セールス担当者</th>
						<td><input type="text" name="sal_manager" value="{{$forms.sal_manager}}" id="text_information" class="text" /></td>
					</tr>
					<tr>
						<th>登録日</th>
						<td><input type="text" id="r_date1"  name="r_date1" value="{{$forms.r_date1}}" style="width: 100px" class="text" />&nbsp;～&nbsp;<input type="text" id="r_date2" name="r_date2" value="{{$forms.r_date2}}" style="width: 100px" class="text" /></td>
					</tr>
					<tr>
						<th>更新日</th>
						<td><input type="text" id="u_date1" name="u_date1" value="{{$forms.u_date1}}" style="width: 100px" class="text" />&nbsp;～&nbsp;<input type="text" id="u_date2" name="u_date2" value="{{$forms.u_date2}}"  style="width: 100px" class="text" /></td>
					</tr>
				</thead>			
			</table>
			<br/>
			<h5>見積情報</h5>
			<table id="inquiry_result" class="formTable">
				<thead>
					<tr>
						<th>見積NO.</th>
						<td><input type="text" name="price_no" id="text_information" class="text" value="{{$forms.price_no}}"  /></td>
					</tr>
					<tr>
						<th>件名</th>
						<td>
						<select id="text_information" name="pro_name" class="text" >
							<option value="">選択してください</option>
											
							{{ foreach from=$make_price_option key=k item=v }}
								<option value="{{$k}}" {{if $forms.pro_name == $k }} selected {{/if}} >{{$v}}</option>
							{{ /foreach }}
									
						</select>
						
						</td>
					</tr>
					<tr>
						<th>型番</th>
						<td><input value="{{$forms.category}}" type="text" name="category" id="text_information" class="text" /></td>
					</tr>
					<tr>
						<th>作成日</th>
						<td><input value="{{$forms.m_date1}}" type="text" id="m_date1"  name="m_date1" style="width: 100px" class="text" />&nbsp;～&nbsp;<input value="{{$forms.m_date2}}" type="text" id="m_date2" name="m_date2" style="width: 100px" class="text" /></td>
					</tr>
					<tr>
						<th>更新日</th>
						<td><input value="{{$forms.u_date3}}" type="text" id="u_date3" name="u_date3" style="width: 100px" class="text" />&nbsp;～&nbsp;<input value="{{$forms.u_date4}}" type="text" id="u_date4" name="u_date4" style="width: 100px" class="text" /></td>
					</tr>
					<tr>
						<th>作成者</th>
						<td><input value="{{$forms.producer}}" type="text" name="producer" id="text_information" class="text" /></td>
					</tr>
					<tr>
						<th>状態</th>
						<td>
							<input type="checkbox" id="status" name="status1" value="1" {{ if $forms.status1 == '1'  }}checked{{ /if }} >作成中</input>&nbsp;&nbsp;
							<input type="checkbox" id="status" name="status2" value="2" {{ if $forms.status2 == '2'  }}checked{{ /if }}>承認依頼中</input>&nbsp;&nbsp;
							<input type="checkbox" id="status" name="status3" value="3" {{ if $forms.status3 == '3'  }}checked{{ /if }}>承認済み</input>&nbsp;&nbsp;
							<input type="checkbox" id="status" name="status4" value="4" {{ if $forms.status4 == '4'  }}checked{{ /if }}>承認却下</input>&nbsp;&nbsp;
							<input type="checkbox" id="status" name="status5" value="5" {{ if $forms.status5 == '5'  }}checked{{ /if }}>客先OK</input>&nbsp;&nbsp;
							<input type="checkbox" id="status" name="status6" value="6" {{ if $forms.status6 == '6'  }}checked{{ /if }}>客先NG</input>
						</td>
					</tr>
					<tr>
						<th>承認日</th>
						<td><input value="{{$forms.e_date1}}" type="text" id="e_date1"  name="e_date1" style="width: 100px" class="text" />&nbsp;～&nbsp;<input value="{{$forms.e_date2}}" type="text" id="e_date2" name="e_date2" style="width: 100px" class="text" /></td>
					</tr>
					<tr>
						<th>客先OK日</th>
						<td><input value="{{$forms.u_date5}}" type="text" id="u_date5" name="u_date5" style="width: 100px" class="text" />&nbsp;～&nbsp;<input value="{{$forms.u_date6}}" type="text" id="u_date6" name="u_date6" style="width: 100px" class="text" /></td>
					</tr>
				</thead>			
			</table>
			<p class="button">
				<button type="submit" id="btn_search" class="submit"><span>検索</span></button>
				<button type="reset" id="btn_reset" class="submit"><span>検索条件クリア</span></button>
			</p>
			</form><br/>
			
			<p class="message">検索へ<span style="color: red">{{$cnt}}</span>レコード</p>
			
			{{ if $cnt > 0 }}
			<h2>検索結果</h2>
			<form name="form1" action="price_csv.php" method="get">
		
<input type="hidden" name="page" value="{{$page.current}}"/>	
<input type="hidden" name="company_name" value="{{$forms.company_name}}"/>
<input type="hidden" name="katakana" value="{{$forms.katakana}}"  />
<input type="hidden" name="branch_name" value="{{$forms.branch_name}}"  />
<input type="hidden" name="sal_manager" value="{{$forms.sal_manager}}"  />
<input type="hidden" name="r_date1" value="{{$forms.r_date1}}"  />
<input type="hidden" name="r_date2" value="{{$forms.r_date2}}"  />
<input type="hidden" name="u_date1" value="{{$forms.u_date1}}" />
<input type="hidden" name="u_date2" value="{{$forms.u_date2}}" />
<input type="hidden" name="price_no"  value="{{$forms.price_no}}"  />
<input type="hidden" name="pro_name"  value="{{$forms.pro_name}}"  />
	
<input value="{{$forms.category}}" type="hidden"  name="category"  />
<input value="{{$forms.m_date1}}"  type="hidden"  name="m_date1"  />
<input value="{{$forms.m_date2}}"  type="hidden"  name="m_date2" />
<input value="{{$forms.u_date3}}"  type="hidden"  name="u_date3"  />
<input value="{{$forms.u_date4}}"  type="hidden"  name="u_date4" />
<input value="{{$forms.producer}}" type="hidden"  name="producer" />

{{ if $forms.status1 == '1'  }}<input type="hidden" name="status1" value="1" /> {{ /if }}
{{ if $forms.status1 == '2'  }}<input type="hidden" name="status2" value="2" /> {{ /if }}
{{ if $forms.status1 == '3'  }}<input type="hidden" name="status3" value="3" /> {{ /if }}
{{ if $forms.status1 == '4'  }}<input type="hidden" name="status4" value="4" /> {{ /if }}
{{ if $forms.status1 == '5'  }}<input type="hidden" name="status5" value="5" /> {{ /if }}
{{ if $forms.status1 == '6'  }}<input type="hidden" name="status6" value="6" /> {{ /if }}

<input value="{{$forms.e_date1}}" type="hidden"  name="e_date1" />
<input value="{{$forms.e_date2}}" type="hidden"  name="e_date2" />
<input value="{{$forms.u_date5}}" type="hidden"  name="u_date5" />
<input value="{{$forms.u_date6}}" type="hidden"  name="u_date6" />

			<table  class="formTable">
				<thead>
					<tr align="center">
						<th>見積NO.</th>
						<th>作成日<br/>更新日</th>
						<th style="width:13%" >会社名</th>
						<th>セールス<br/>担当者</th>
						<th>件名</th>
						<th>作成者</th>
						<th>承認者</th>
						<th>承認日</th>
						<th>客先同意</th>
						<th>更新</th>
						<th>見積書</th>
						<th style="width:150px" >見積書コピー</th>
						<th>単価稟議書</th>
					</tr>

				</thead>
				<tbody>
{{ foreach from=$resultlist key=k item=v }}
					<tr align="center">
						<td>{{ $v.price_no }}</td>
						<td>{{ $v.m_date }}<br/>{{$v.u_date}}</td>
						<td align="left">{{ $v.company_name }}</td>
						<td>{{ $v.sal_manager }}</td>
						<td><img src="assets/images/titleicon/{{ $v.pro_name }}.gif"></img><!--  $make_price_option[$v.pro_name] }} --></td>
						<td>{{ $v.producer }}</td>
						<td>{{ $staff[$v.examiner] }}</td>
						<td>{{ $v.e_date }}</td>
						<td>{{ $v.opt }}</td>
						<td><a href='make_price.php?price_no={{$v.price_no}}&consumer_id={{$v.consumer_id}}'>[更新]</a></td>
						<td><a href='javascript:openWin("price_book.php?price_no={{$v.price_no }}&consumer_id={{$v.consumer_id}}",800,800)'>[印刷画面]</a></td>
						<td><a href='javascript:openWin("consumer_select.php?price_no={{$v.price_no }}&consumer_id={{$v.consumer_id}}",500,400)'>[見積書コピー]</a></td>
						<td><a href='javascript:openWin("price_resolution.php?price_no={{$v.price_no}}&consumer_id={{$v.consumer_id}}",800,800)'>[印刷画面]</a></td>
					</tr>
{{ /foreach }}
				</tbody>
			</table>
			
						<p align="center">
{{ if $page.current > 1 }}
				<a href="price_check.php?page={{ $page.current-1 }}{{ $page.query }}">前の{{ $page.item }}件</a>&nbsp;&nbsp;
{{ /if }}
{{ foreach from=$page.paging key=k item=v }}
{{ if $v < $page.current+15 }}
{{ if $page.current == $v }}
{{ $v }}&nbsp;
{{ else }}
				<a href="price_check.php?page={{ $v }}{{ $page.query }}">{{ $v }}</a>&nbsp;
{{ /if }}
{{ /if }}
{{ /foreach }}
{{ if $page.end > $page.current }}
				<a href="price_check.php?page={{ $page.current+1 }}{{ $page.query }}">次の{{ $page.item }}件</a>
{{ /if }}
			</p>
			
				<p class="button">
					<button type="submit" id="btn_csv" class="submit" ><span>CSV出力</span></button>
				</p>
		{{/if}}	
		</form>
			<br/><br/>			
		</div>
		</div>
			
			
		<address>Copyright (C) SHIFT Inc. / All rights reserved</address>

	</body>
</html>